/* eslint valid-jsdoc: "off" */

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1676792574286_2166';

  // add your middleware config here
  config.middleware = [
    'errorHandler',
  ];

  config.errorHandler = {
    match: '/api',
  };
  // CSRF  enable: false
  config.security = {
    csrf: {
      enable: false,
    },
  };

  config.multipart = {
    mode: 'stream', // 启用 stream 模式
    fileModeMatch: /(\/thesisUpload)$/, // /thesisUpload接口使用file模式，其他使用stream模式
    fileSize: 1048576000,
    whitelist: [ '.xlsx', '.pdf', '.doc', '.docx' ], // 白名单，把你的文件类型加上，不然会报错
  };

  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };

  return {
    ...config,
    ...userConfig,
  };
};
